<?php
/**
 * 【超人】模块定义
 *
 * @author 超人
 * @url http://s.w7.cc/developer/index/59968
 */
global $_W;
defined('IN_IA') or exit('Access Denied');
define('SUPERMAN_MODULE_NAME', 'superman_test');
if (!defined('MODULE_ROOT')) {
    define('MODULE_ROOT', IA_ROOT.'/addons/'.SUPERMAN_MODULE_NAME.'/');
}
define('MODULE_URL', $_W['siteroot'].'addons/'.SUPERMAN_MODULE_NAME.'/');
define('ATTACHMENT_ROOT', IA_ROOT .'./attachment/');
if (file_exists(IA_ROOT.'/local.lock')) {
    define('LOCAL_DEVELOPMENT', true);
} else if (file_exists(IA_ROOT.'/online-dev.lock')) {
    define('ONLINE_DEVELOPMENT', true);
}
if (defined('LOCAL_DEVELOPMENT') || defined('ONLINE_DEVELOPMENT')) {
    define('SUPERMAN_DEVELOPMENT', true);
}
//超级商城
define('SUPERMAN_MALL_MODULE_ROOT', IA_ROOT.'/addons/superman_mall/');
define('SUPERMAN_MALL_MODULE_URL', $_W['siteroot'].'addons/superman_mall/');
//积分商城
define('SUPERMAN_CREDITMALL_MODULE_ROOT', IA_ROOT.'/addons/superman_creditmall/');
define('SUPERMAN_CREDITMALL_MODULE_URL', $_W['siteroot'].'addons/superman_creditmall/');
//regular
define('SUPERMAN_REGULAR_EMAIL', '/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i');
define('SUPERMAN_REGULAR_MOBILE', '/1\d{10}/');
define('SUPERMAN_REGULAR_USERNAME', '/^[a-z\d_]{4,16}$/i');
define('SUPERMAN_REGULAR_PASSWORD', '/^\w{6,16}$/i');

load()->func('tpl');
load()->func('file');
load()->func('communication');
load()->model('mc');
load()->model('module');
load()->model('account');

spl_autoload_register(function($class) {
    $class = str_replace('SupermanTest', '', $class);
    $class = str_replace('_', '/', $class);
    $class = strtolower($class);
    $file = MODULE_ROOT.'class/'.$class.'.class.php';
    if (file_exists($file)) {
        require $file;
    }
});

SupermanTestUtil::weiqing_polyfill();